package com.tencent.wxcloudrun.controller;

import com.jfinal.weixin.sdk.kit.SignatureCheckKit;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/wx0b887c4d6d3ba8ce")
public class Vwx0b887c4d6d3ba8ceController {
	
	@Value("token")
	private String token;

	@GetMapping(value = "/verify")
	String get(@RequestParam(required=false) String signature,@RequestParam(required=false) String timestamp,@RequestParam(required=false) String nonce,@RequestParam(required=false) String echostr) {
		boolean b = new SignatureCheckKit().checkSignature(signature, token, timestamp, nonce);
		if(b){
			return echostr;
		}
		return echostr;
	}

	

}